<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://"
			+ request.getServerName() + ":" + request.getServerPort()
			+ path;
%>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta name="viewport" content="width=device-width,initial-scale=1,user-scalable=0">
<title>学生解绑-云校通</title>
<jsp:include page="/WEB-INF/page/common/_header.jsp"></jsp:include>
</head>
<body ontouchstart>
	<div class="weui_tab tab-bottom">
		<div class="weui-header bg-blue">
	  		<div class="weui-header-left"> <a href="<%=basePath %>/ls/my" class="icon icon-109 f-white">返回</a> </div>
	    	<h1 class="weui-header-title">学生解绑</h1>
		</div>
		<div class="searchbar_wrap"></div>
	    <div id="search-content" style="height: 100%;z-index: 10;position:relation;display: none;">
	       <div class="sb-content mb90" style="overflow:scroll;padding:0;">
	       		<div class="weui_cells mt0" id="searchList">
	       		</div>
	       </div>
	    </div>
		<div class="weui_tab_bd">
	        <div class="weui_cells mt0 mb90" id="teacherList">
	        	<c:forEach var="itm" items="${list }">
		        	<div class="weui_cell">
		            	<div class="weui_cell_hd weui_center_33">${itm.gradeName }${itm.clazz }班</div>
		            	<div class="weui_cell_hd weui_center_33">${itm.studentName}</div>
		            	<div class="weui_cell_hd weui_center_33">
		            		<button class="weui_btn weui_btn_mini bg-red f-white" onclick="studentUnbind(${itm.relId},'${itm.studentName }')">解绑</button>
		            	</div>
		            </div>
	        	</c:forEach>
	        </div>
		</div>
	</div>
<jsp:include page="/WEB-INF/page/common/_footer.jsp"></jsp:include>
<script type="text/javascript">
	function studentUnbind(relId, studentName) {
		$.confirm("", "确认与"+studentName+"同学解除绑定?", function() {
			$.ajax({
				url: basePath + "/student/unbind/submit",
				type: 'POST',
				dataType : "json",
				data: {
					relId: relId
				},
				success: function(data) {
					if(data.code == '000') {
						$.toast("解绑成功！");
						setTimeout(function() {
							window.location.href = window.location.href+"&v="+new Date().getTime();
						}, 1000)
					}else {
						$.toast(data.msg);
					}
				},
				error: function(data) {
				}
			});
		})
	}
</script>
</body>
</html>